#Copyright Ken Faulkner 2007.
import traceback


    
class AudioDetails( object ):


  # status messages.
  # not sure this is really the right location for this.
  STATUS_DOWNLOADED =             0 
  STATUS_ERROR =                  1 
  STATUS_OTHER =                  2
  STATUS_DOWNLOADING =            3   # pass percentage aswell
  STATUS_NORMAL =                 4
  STATUS_FOUND_IN_SEARCH =        5
  STATUS_MARKED_FOR_DOWNLOAD =    6
  STATUS_COMPLETELY_FINISHED =    7  
  STATUS_START_DOWNLOAD =         8
  STATUS_PERCENTAGE_CHANGED =     9
  STATUS_NOT_DOWNLOADING =        10
  STATUS_NO_CHANGE =              11
  STATUS_DOWNLOAD_ERROR =         12
  
  
  def __init__(self):
    self.link = None
    self.title = None
    self.description = None
    
    self.album = None
  
    # if episode is parsed, then enter here.
    self.episode_no = 0
    
    # date of entry
    self.date = None
    
    # duration of broadcast.
    # need to rename it sometime.
    self.time = None
    
    # estimated size of the download.
    self.estimated_size = None
    
    # percent completed for download.
    self.percent_complete = None
    
    # status
    # downloaded
    # downloading
    # included in search etc.
    self.status = AudioDetails.STATUS_NORMAL
        
    self.checked_for_download = False


    # mp3 filename.
    self.mp3_filename = ""

    # I SOOOOOOOOOOOOO HATE THIS BEING HERE.
    # I NEED TO MAKE LEVELS OF ABSTRACTION
    self.thread_no = None
    
  def __str__(self):
  
    s = "Link " + self.link
    s += "\nTitle " + self.title
    s += "\nAlbum " + self.album    
    s += "\nDesc " + self.description
    s += "\nep " + str( self.episode_no )
    s += "\ndate " + str( self.date )
    s += "\ntime " + str( self.time )
    s += "\nstatus " + str( self.status )
    s += "\nmp3 " + str( self.mp3_filename )
    s += "\nestimated size " + str( self.estimated_size )
    s += "\npercent complete " + str( self.percent_complete )
    

    return s
